Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python-pyqt5-清除QTextBrowser的选择_Python_Qt_Pyqt5_Qtextbrowser - Fatal编程技术网

Python-pyqt5-清除QTextBrowser的选择

Python-pyqt5-清除QTextBrowser的选择,python,qt,pyqt5,qtextbrowser,Python,Qt,Pyqt5,Qtextbrowser,我想清除QTextBrowser中的选择(清除突出显示) 以上代码对我无效。请尝试以下操作: cursor = self.textBrowser.textCursor() cursor.clearSelection() self.textBrowser.setTextCursor(cursor) self.textBrowser.textCursor()返回的游标只是所使用的textCursor的副本。要将更改应用到文本浏览器,必须对副本进行操作,然后将文本浏览器文本光标设置为修改后的版本。尝

我想清除
QTextBrowser
中的选择(清除突出显示)

以上代码对我无效。

请尝试以下操作:

cursor = self.textBrowser.textCursor()
cursor.clearSelection()
self.textBrowser.setTextCursor(cursor)
self.textBrowser.textCursor()
返回的游标只是所使用的textCursor的副本。要将更改应用到文本浏览器,必须对副本进行操作,然后将文本浏览器文本光标设置为修改后的版本。

尝试以下操作:

cursor = self.textBrowser.textCursor()
cursor.clearSelection()
self.textBrowser.setTextCursor(cursor)

self.textBrowser.textCursor()
返回的游标只是所使用的textCursor的副本。若要将更改应用到文本浏览器,您必须对副本进行操作,然后将文本浏览器文本光标设置为修改版本。

通过“清除突出显示”您的意思是希望文本不再突出显示,还是希望从文本浏览器中删除突出显示的文本?我需要文本不突出显示。通过“清除突出显示”您的意思是希望文本不再突出显示,还是希望从文本浏览器中删除突出显示的文本?我需要文本不突出显示。