[immodule-qt] Some more things for Qt 4
Lars Knoll
lars at trolltech.com
Thu Oct 14 11:23:12 EEST 2004
Hi,
I've got some more comments/questions that came up while we integrated your
code for Qt 4:
* I don't like the concept of the icHolderWidgets. They require inheriting
either the widget or QApplication only to specify that a widget should have
an input context of it's own. I'd prefer a solution where one only needs to
set a widget attribute to achieve this:
myWidget->setAttribute(Qt::WA_OwnInputContext);
After this call the widget will have it's own private input context, that one
can then set/change with QWidget::changeInputContext. IMO this would make the
usage of private input contexts for certain widgets a lot easier.
* QApplication::changeAllInputContext(), does set all input contexts in the
app to the new method. I am not sure, but I think that such a method should
not include input contexts that are private to a certain widget.
* Do we really need one input context per top level widget? Wouldn't it be
enough to have one per application (apart from private contexts)? We could
then have QApplication::setInputContext() to change the global (app wide)
input context, and QWidget::setInputContext() to set a private input context.
* I would like to unify the virtual imStart,imCompose and imEndEvent methods
into one virtual QWidget::imEvent() method. This will give us more
flexibility in the future to change and extend the QIMEvent structure.
* The input method needs a way to query properties of the input widget. One
example is surrounding text, another one is reconversion. The patch I saw for
surrounding relying on a virtual method to return exatly this one property.
This has the disadvantage that it is not extensible in the future. For that
reason I'd like to propose that we add a slightly different virtual method to
QWidget:
virtual QVariant imQuery(IMProperty prop);
IMProperty is an enum, that will contain several things:
enum IMProperty {
IMCursorPosition,
IMSurroundingText,
IMCurrentSelection, // for reconversion
....
};
The advantage of returning a QVariant is that we can put all the information
we need into this one method, and can freely extend the enum later without
having to break binary or backwards compatibility.
* imDeleteSurrounding() could then be replaced by a special QIMEvent.
Cheers,
Lars
More information about the immodule-qt
mailing list