Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    Solved QCompleter: Multiple words in one line, want completion on each word individually

    General and Desktop
    4
    5
    2380
    Loading More Posts
    • 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.
    • M
      Mamegohan last edited by

      Hi,

      I'm using QCompleter to complete words in a QLineEdit. The lineedit handles the input to a command-line interface (built on AngelScript), so I must support lines like:
      Item i = Item("ItemName");
      and similar.

      I've collected all keywords and identifiers in a QStringListModel and set that as the completion model. If I type

      Ite
      

      I will get "Item" suggested to me. However, if I continue typing:

      Item ite
      

      I do not get a suggestion for the second word. I'd be grateful for any ideas on how to do this.

      Thanks in advance!

      1 Reply Last reply Reply Quote 0
      • mrjj
        mrjj Lifetime Qt Champion last edited by

        Hi
        The default operation will not do that I think as it see full text and dont know
        u want only the newly typed.
        The functionality you are after seems to be very like
        http://doc.qt.io/qt-5/qtwidgets-tools-customcompleter-example.html

        M 1 Reply Last reply Reply Quote 0
        • mrjj
          mrjj Lifetime Qt Champion last edited by

          Hi
          The default operation will not do that I think as it see full text and dont know
          u want only the newly typed.
          The functionality you are after seems to be very like
          http://doc.qt.io/qt-5/qtwidgets-tools-customcompleter-example.html

          M 1 Reply Last reply Reply Quote 0
          • M
            Mamegohan @mrjj last edited by

            @mrjj

            Thanks for the link! I will give it a shot.

            1 Reply Last reply Reply Quote 0
            • R
              rohrlich last edited by

              If you have found the answer I would love to know it!

              kshegunov 1 Reply Last reply Reply Quote 0
              • kshegunov
                kshegunov Moderators @rohrlich last edited by kshegunov

                The answer is to write your custom completer. See @mrjj's link for details.

                Read and abide by the Qt Code of Conduct

                1 Reply Last reply Reply Quote 2
                • First post
                  Last post