qt获取光标位置
2015-05-15 17:49
1201 查看
在写qt本版的IM软件时 想要实现@功能,需要获取输入@时的光标坐标(像素坐标);
直接上代码;
const QInputMethod *inputMethod = qApp->inputMethod();
QRect cursorRectangle = inputMethod->cursorRectangle().toRect();
int x = cursorRectangle.x();
int y = cursorRectangle.y();
效果图:
直接上代码;
const QInputMethod *inputMethod = qApp->inputMethod();
QRect cursorRectangle = inputMethod->cursorRectangle().toRect();
int x = cursorRectangle.x();
int y = cursorRectangle.y();
效果图:
相关文章推荐
- 动态获取当前屏幕中光标所在位置的颜色
- EditText设置/隐藏光标位置、选中文本和获取/清除焦点
- javascript获取textarea光标选择位置和内容方法(IE, Firefox)
- android EditText获取光标位置并且插入字符或者删除字符
- 用C语言在linux下获取鼠标光标的相对位置
- Qt获取系统相关位置
- 获取文本域中的光标所在的位置
- c# 获取文本框(TextBox)中鼠标,光标位置
- UITextView获取光标位置
- EditText设置/隐藏光标位置、选中文本和获取/清除焦点
- 用 javascript 获取当页面上鼠标(光标)位置 和 触发事件的对象 的方法
- 获取/设置input中的鼠标光标位置
- 获取textarea光标选择位置和内容方法(IE, Firefox)
- js获取光标位置
- Javascript设置和获取Textarea的光标位置的方法(亲测有用),可定位光标到某个位置
- EditText设置/隐藏光标位置、选中文本和获取/清除焦点
- JQ插件:获取文本框(textarea)内的所选字符和光标位置索引值-selection
- [Android教程]EditText设置/隐藏光标位置、选中文本和获取/清除焦点
- EditText设置/隐藏光标位置、选中文本和获取/清除焦点