QTextEdit Completer
-
I want to be able to have my
QTextEditautocomplete...I have
self.text_edit.textChanged.connect(self.on_text_change)whereself.text_editis an instance ofQtWidgets.QTextEditdef 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. -
I want to be able to have my
QTextEditautocomplete...I have
self.text_edit.textChanged.connect(self.on_text_change)whereself.text_editis an instance ofQtWidgets.QTextEditdef 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
NormallyQCompleteris used on a single-lineQLineEdit. To get it to work on aQ[Plain]TextEdityou 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