如何将 QTextCursor 从 QTextEdit 移动到另一个 QTextEdit?
How to move the QTextCursor from QTextEdit to another QTextEdit?
如何将QTextCursor从QTextEdit移动到另一个QTextEdit?这是我的代码:
self.textedit = QTextEdit(MainWindow)
self.textedit_2 = QTextEdit(MainWindow)
self.cursor = self.textedit.textCursor()
self.button.clicked.connect(self.moveCursor)
def moveCursor(self):
self.textedit_2.setTextCursor(self.cursor)
光标与小部件的焦点有关,因此您需要先设置焦点
textedit_2.setFocus()
self.textedit = QTextEdit(MainWindow)
self.textedit_2 = QTextEdit(MainWindow)
self.cursor = self.textedit.textCursor()
self.button.clicked.connect(self.moveCursor)
def moveCursor(self):
self.cursor = self.textedit_2.textCursor()
self.textedit_2.setFocus()
self.tetxtedit_2.setTextCursor(self.cursor)
如何将QTextCursor从QTextEdit移动到另一个QTextEdit?这是我的代码:
self.textedit = QTextEdit(MainWindow)
self.textedit_2 = QTextEdit(MainWindow)
self.cursor = self.textedit.textCursor()
self.button.clicked.connect(self.moveCursor)
def moveCursor(self):
self.textedit_2.setTextCursor(self.cursor)
光标与小部件的焦点有关,因此您需要先设置焦点
textedit_2.setFocus()
self.textedit = QTextEdit(MainWindow)
self.textedit_2 = QTextEdit(MainWindow)
self.cursor = self.textedit.textCursor()
self.button.clicked.connect(self.moveCursor)
def moveCursor(self):
self.cursor = self.textedit_2.textCursor()
self.textedit_2.setFocus()
self.tetxtedit_2.setTextCursor(self.cursor)