有没有办法将pyqt文本光标移动到没有文本的地方

时间:2017-07-22 04:15:40

标签: python-2.7 python-3.x pyqt pyqt4 pyqt5

enter image description here我正在创建一个文本编辑器,现在我想要将qtextcursor移动到行的开头,但是文本光标只会从单词的开始处移动而不是行的实际开始,如果有的话在下一个区块中没有任何字,光标不会移动到那里。无论如何都在那里

cursor.movePosition(16)
self.textEdit.setTextCursor(cursor)
#but this will only work if there is atleast one word in the next block

cursor.setPosition(0) 
#this will move the cursor to the word from where the document starts not the actual start of the document

cursor.movePosition(3)
#this will do the same

我在我的文本编辑器中创建列表功能(我使用内置的光标创建列表)但我需要修改一点,为此我必须完全控制光标。我也尝试使用选项卡和退格键spantounasly但导致问题

查看图像。光标位于蓝色位置。但我希望它位于黑色位置,但目前只有在黑色位置有文字时才可以使用

0 个答案:

没有答案