gpt4 book ai didi

python - pyqt:获取文本光标的当前行号

转载 作者:太空宇宙 更新时间:2023-11-03 18:51:21 24 4
gpt4 key购买 nike

有没有办法获取 QTextWidget 中文本光标的当前行号?我在 documentation. 中找不到任何内容

最佳答案

这个问题已经在 How to get column number in qtextedit? 得到了回答

QTextCursor cursor = ui.textEdit->textCursor();
int y = cursor.blockNumber() + 1;
int x = cursor.columnNumber() + 1;

关于python - pyqt:获取文本光标的当前行号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18304748/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com