* 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/branches/BRANCH_1_6_X@33079 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jürgen Spitzmüller 2010-01-18 10:06:40 +00:00
parent 0a56db348c
commit 181a9338f4
3 changed files with 29 additions and 11 deletions

View File

@ -30,6 +30,7 @@
#include "support/lstrings.h"
#include "support/textutils.h"
#include <QKeyEvent>
#include <QListWidgetItem>
#if defined(USE_ASPELL)
@ -74,6 +75,8 @@ GuiSpellchecker::GuiSpellchecker(GuiView & lv)
wordED->setReadOnly(true);
suggestionsLW->installEventFilter(this);
bc().setPolicy(ButtonPolicy::NoRepeatedApplyReadOnlyPolicy);
bc().setCancel(closePB);
}
@ -85,6 +88,24 @@ GuiSpellchecker::~GuiSpellchecker()
}
bool GuiSpellchecker::eventFilter(QObject *obj, QEvent *event)
{
if (obj == suggestionsLW && event->type() == QEvent::KeyPress) {
QKeyEvent *e = static_cast<QKeyEvent *> (event);
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
suggestionChanged(suggestionsLW->currentItem());
replace();
return true;
} else if (e->key() == Qt::Key_Right) {
suggestionChanged(suggestionsLW->currentItem());
return true;
}
}
// standard event processing
return QWidget::eventFilter(obj, event);
}
void GuiSpellchecker::suggestionChanged(QListWidgetItem * item)
{
if (replaceCO->count() != 0)

View File

@ -52,6 +52,9 @@ private:
///
void updateContents();
///
bool eventFilter(QObject *obj, QEvent *event);
///
enum State {
SPELL_PROGRESSED, //< update progress bar

View File

@ -27,8 +27,6 @@ What's new
- LyX now supports SVG images when either the librsvg library or
or Inkscape (version 0.47 recommended) is installed (bug 3349).
- The definition of multi-accented polytonic Greek has been simplified.
- LaTeX import (tex2lyx) now recognizes the types of quotes dependent
on the document language. (When importing e.g. a Spanish document,
LyX will use comillas latinas as quotes.)
@ -57,8 +55,8 @@ What's new
- The dinbrief template was revised.
- Updated Czech, German, Indonesian, Italian, Russian, Slovak and Spanish
user interface localization.
- Updated Czech, French, German, Indonesian, Italian, Russian, Slovak
and Spanish user interface localization.
- The rpm README file was updated.
@ -72,7 +70,6 @@ What's new
- Add support for Cygwin 1.7.
** Bug fixes:
*************
@ -96,8 +93,6 @@ What's new
- LaTeX import (tex2lyx) now also recognizes the document language Kazakh.
- Fix polytonic Greek macro definition.
* USER INTERFACE
@ -118,8 +113,8 @@ What's new
- Fix cursor placement in math when inserting 'active' insets (bug 6382).
- Fix display of author names containing a thin space (\,) in the
citation inset.
- Fix on-screen display of author names containing a thin space
(such as W.\,H. Auden).
- Take into account the current zoom factor, dip, or preview scale
factor when an instant preview is generated.
@ -146,8 +141,7 @@ What's new
- Better detection and response on svn conflicts.
- Add more keyboard accelerators to the spellchecker dialog
(part of bug 6460).
- Enable full keyboard navigation in the spellchecker dialog (bug 6460).
* DOCUMENTATION AND LOCALIZATION