Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTextEdit Completer
Qt 6.11 is out! See what's new in the release blog

QTextEdit Completer

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    Caeden
    wrote on last edited by
    #1

    I want to be able to have my QTextEdit autocomplete...

    I have self.text_edit.textChanged.connect(self.on_text_change) where self.text_edit is an instance of QtWidgets.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.

    JonBJ 1 Reply Last reply
    0
    • C Caeden

      I want to be able to have my QTextEdit autocomplete...

      I have self.text_edit.textChanged.connect(self.on_text_change) where self.text_edit is an instance of QtWidgets.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.

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote on last edited by
      #2

      @Caeden
      Normally QCompleter is used on a single-line QLineEdit. To get it to work on a Q[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

      1 Reply Last reply
      1
      • C Offline
        C Offline
        Caeden
        wrote on last edited by
        #3

        Sorry, I'm still confused

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved