0
我在meego上使用QT的输入法项目。如何让光标在QT中向前/向后移动?
这里是一个例子:如果用户在输入小部件时输入“(”,应该显示一个“)”。你知道,此时光标处于“)”的位置,但它应该在括号之间。
我该怎么办?与QT
我在meego上使用QT的输入法项目。如何让光标在QT中向前/向后移动?
这里是一个例子:如果用户在输入小部件时输入“(”,应该显示一个“)”。你知道,此时光标处于“)”的位置,但它应该在括号之间。
我该怎么办?与QT
OK,我找到了正确的方法:
QEvent *movePress= new QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier);
QApplication::sendEvent (focusWidget, movePress);
QEvent *moveRelease= new QKeyEvent(QEvent::KeyRelease, Qt::Key_Left, Qt::NoModifier);
QApplication::sendEvent(focusWidget,moveRelease);
[?你尝试过什么(http://mattgemmell.com/2008/12/08/what-have-you-tried/ ) –
如果你使用'QLineEdit',有游标方法(cursorBackward,cursorForward,cursorPosition等)http://developer.meego.com/api/1.2/qt4/qlineedit.html – HostileFork