计算QPlaintTextEdit当前光标(cursor)的行号
2016-01-18 09:32
696 查看
//get the current line number QTextCursor tc = edit->textCursor(); QTextLayout* lo = tc.block().layout(); //get the relative position in the block int pos = tc.position() - tc.block().position(); int line = lo->lineForTextPosition(pos).lineNumber() + tc.block().firstLineNumber(); qWarning() << line;
相关文章推荐
- Module *** must not contain source root "...P
- 3.You need to extract details of those products in the SALES table where the PROD_ID column contains
- PyCairo指南--基本绘图
- Tair ldb(leveldb存储引擎)实现介绍
- 从比特币到区块链的未来
- AS-->AIDL: xxx should be declared in a file called xxx
- QWidget、QDialog、QMainWindow的异同点
- QWidget、QDialog、QMainWindow的异同点
- ENVI Error:SaveRasterFile failed
- RAID各级别特性
- [LeetCode] 219. Contains Duplicate II 解题思路
- 使用MapReduce实现pairs算法实现单词的共现矩阵
- trait学习 笔记整理
- 615B Longtail Hedgehog
- 605A Sorting Railway Cars
- Naive Bayesian文本分类器
- adb 安装apk报INSTALL_FAILED_NO_MATCHING_ABIS
- YARN中用的作业调度算法:DRF(Dominant Resource Fairness)
- 4.5 可信度方法
- A charge WIFI point base on airbase-ng+dhcp+lamp+wiwiz