QTextEdit Completer
-
I want to be able to have my
QTextEdit
autocomplete...I have
self.text_edit.textChanged.connect(self.on_text_change)
whereself.text_edit
is an instance ofQtWidgets.QTextEdit
def on_text_change(self): print("text changed")
How can I just make it automatically show the options
["a", "b", "c"]
everytime a letter is pressed? This is a rough example, I would sort out the filtering which is the easy part but I'm not sure how to create the option to complete. -
@Caeden
NormallyQCompleter
is used on a single-lineQLineEdit
. To get it to work on aQ[Plain]TextEdit
you have to do some work.
https://doc.qt.io/qt-6/qtwidgets-tools-customcompleter-example.html
https://stackoverflow.com/questions/51912270/qplaintextedit-and-qcompleter-focus-issue
https://forum.qt.io/topic/5265/solved-trying-to-use-qcompleter-in-inline-mode-within-a-custom-qtextedit