[MeeGo-inputmethods] [PATCH 2/2] New preedit face: "Unconvertible"
Andy Ross
andy at plausible.org
Wed Jun 29 09:28:30 PDT 2011
From: Andy Ross <andy.ross at windriver.com>
Add a face for preedit regions which are non-interactive
(specifically: convertible phrases typed after the maximum number of
preedit conversions is already buffered), and a default styling that
renders them in 50% gray.
Signed-off-by: Andy Ross <andy.ross at windriver.com>
---
input-context/minputcontext.cpp | 22 ++++++++++++----------
src/minputmethodnamespace.h | 3 ++-
2 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/input-context/minputcontext.cpp b/input-context/minputcontext.cpp
index 3e9c593..68403fb 100644
--- a/input-context/minputcontext.cpp
+++ b/input-context/minputcontext.cpp
@@ -684,17 +684,19 @@ void MInputContext::updatePreeditInternally(const QString &string,
}
#endif // HAVE_MEEGOTOUCH
} else {
- // hard coded styling:
- format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
-
- QColor underlineColor;
- if (preeditFormat.preeditFace == MInputMethod::PreeditNoCandidates) {
- underlineColor.setRgb(255, 0, 0);
- } else {
- underlineColor.setRgb(0, 0, 0);
+ switch (preeditFormat.preeditFace) {
+ case MInputMethod::PreeditNoCandidates:
+ format.setUnderlineStyle(QTextCharFormat::SpellCheckUnderline);
+ format.setUnderlineColor(QColor(255, 0, 0));
+ break;
+ case MInputMethod::PreeditUnconvertible:
+ format.setForeground(QBrush(QColor(128, 128, 128)));
+ break;
+ case MInputMethod::PreeditKeyPress:
+ case MInputMethod::PreeditDefault:
+ format.setUnderlineStyle(QTextCharFormat::SingleUnderline);
+ break;
}
-
- format.setUnderlineColor(QColor());
}
attributes << QInputMethodEvent::Attribute(QInputMethodEvent::TextFormat,
diff --git a/src/minputmethodnamespace.h b/src/minputmethodnamespace.h
index 08e9c89..a330a4b 100644
--- a/src/minputmethodnamespace.h
+++ b/src/minputmethodnamespace.h
@@ -147,7 +147,8 @@ namespace MInputMethod {
enum PreeditFace {
PreeditDefault,
PreeditNoCandidates,
- PreeditKeyPress //! Used for displaying the hwkbd key just pressed
+ PreeditKeyPress, //! Used for displaying the hwkbd key just pressed
+ PreeditUnconvertible, // Inactive preedit region, not clickable
};
enum HandlerState {
--
1.7.5.4
More information about the MeeGo-inputmethods
mailing list