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. QLineEdit text under cursor
Forum Updated to NodeBB v4.3 + New Features

QLineEdit text under cursor

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 2 Posters 3.5k Views 2 Watching
  • 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.
  • S Offline
    S Offline
    shahriar25
    wrote on last edited by
    #1

    Hi
    I want to get the text under cursor to show the suggestions of QCompleter else where. how can I do this?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Do you mean when hovering a given text ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S Offline
        S Offline
        shahriar25
        wrote on last edited by
        #3

        Hi @SGaist
        when you attach a completer to a lineedit it shows the suggestion as a hovering text. What I want to do is get the list of suggestions for current writing text and show it else where.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What is that elsewhere ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • S Offline
            S Offline
            shahriar25
            wrote on last edited by shahriar25
            #5

            @SGaist
            You can think of it as a terminal emulator in linux. when you press tab the suggestions is shown in the terminal it self and also it auto completes as much as it can.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Isn't what the InlineCompletion mode would do ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • S Offline
                S Offline
                shahriar25
                wrote on last edited by
                #7

                @SGaist
                in inline completion only one suggestion is shown (in a highlighted text) but i want to show all of the possible suggestions

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Something like the windows cmd prompt that cycles through the possibilities or rather like a *nix shell that shows a list of possibilities ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    shahriar25
                    wrote on last edited by
                    #9

                    @SGaist
                    something like nix shell.

                    1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      You can use the completer independently to get the data you want and display them in another widget/region whatever you want. Just don't set it on the line edit and handle the text input yourself.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      1 Reply Last reply
                      0
                      • S Offline
                        S Offline
                        shahriar25
                        wrote on last edited by shahriar25
                        #11

                        @SGaist
                        that is what I intend to do and that brings us to my question. how do I get the text that the user rights and give it to the completer and get the suggestions

                        this is how you get the text in QTextEdit (I found it in qt's examples) :

                        QString TextEdit::textUnderCursor() const
                        {
                        QTextCursor tc = textCursor();
                        tc.select(QTextCursor::WordUnderCursor);
                        return tc.selectedText();
                        }

                        how is this done in lineEdit?

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          You can try to setup a single line QTextEdit like suggested here.

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          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