SendScintilla(SCI_POINTXFROMPOSITION, position);
上面写法是不对的
//注意,case SCI_POINTXFROMPOSITION: 那儿用的是lParam参数,而没有用wParam
//而最外层函数有两种形式SendScintilla(unsigned int msg, long wParam)
//SendScintilla(unsigned int msg, unsigned long wParam = 0,long lParam = 0)
//也就是说最外层的函数必须要调用第二个才行,也就是wParam参数我们一定得调用时给个0所以,容易掉入陷阱,要特别注意。正确的写法如下:
QPoint Editor::getPointXYFromPostion(int position)
{
int x = SendScintilla(SCI_POINTXFROMPOSITION, 0, position);
int y = SendScintilla(SCI_POINTYFROMPOSITION, 0, position);
// y -= textHeight(getLineFromPosition(position));
return QPoint(x, y);
}