【发布时间】:2012-07-25 12:03:11
【问题描述】:
我有以下代码(在 mouseReleaseEvent 中实现)来检测用户何时选择了文本行:
QTextCursor cursor = this->textCursor();
int start = cursor.selectionStart();
int end = cursor.selectionEnd();
if(!cursor.hasSelection())
return; // No selection available
qWarning() << "start: " << start << " end: " << end << endl;
问题是:我需要选择开始和结束的行号。我一直在和积木作斗争,什么也没解决,你能给我一个线索吗?
【问题讨论】: