[immodule-qt] Surrounding text

Anuradha Ratnaweera gnu.slash.linux at gmail.com
Fri Sep 17 15:38:51 EEST 2004


On Thu, 16 Sep 2004 10:11:50 +0600, Anuradha Ratnaweera
<gnu.slash.linux at gmail.com> wrote:
> On Thu, 16 Sep 2004 00:53:33 +0900, Daisuke Kameda
> <kaminmat at cc.rim.or.jp> wrote:
> > > As it turns out (please
> > > correct me if I am wrong), QInputContext doesn't store text string,
> > > but only the preedit.  Where is it stored?  Is it different for each
> > > widget (in which case we will have to implement a function for every
> > > widget)?
> >
> > Yes. In the present implementation, (commited) text string is stored at
> > only each widget. Please refer to QWidget::imEndEvent(),
> > QLineEdit::imEndEvent(), and QWidget::imEndEvent().
> 
> Thanks.  Saved a lot of time for me!
> 
> BTW, I guess you meant QWidget::imEndEvent() and QLineEdit::imEndEvent(). :-)

Sorry about the stupid question.  grepping -l for imEndEvent in
src/widgets/ showed that you meant QWidget, QLineEdit and QTextEdit.

Anyway, implementing getSurrounding as an event doesn't look nice,
because it needs to return both the text and cursor positon. 
QLineEdit already can return cursor position and text, and backspace()
and delte() functions, while QTextEdit also can do somewhat similar.

After considering several options, I am thinking of doing it this way:
please comment.  (Please forgive my poor knowledge of OOP terminology.
:-))

- Implement getSurrounding() and deleteSurrounding() in QWidget which
does nothing (and returns null).

- QLineEdit and QTextEdit overides imGetSurrounding() and imDeleteSurrounding().

- QInputContext implements getSurrounding() and deleteSurrounding().

At the same time, I am writing, rather porting from gtk-im, the
Sinhala (Transliterated) input method, so that I have something to
test along the way.

http://cvs.linux.lk/cgi-bin/cvsweb/sinhala/qt/im/

        Anuradha

-- 

http://www.linux.lk/~anuradha/
http://www.gnu.org/philosophy/no-word-attachments.html



More information about the immodule-qt mailing list