Unsolved QLineEdit text under cursor
-
Hi
I want to get the text under cursor to show the suggestions of QCompleter else where. how can I do this? -
Hi,
Do you mean when hovering a given text ?
-
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. -
What is that elsewhere ?
-
@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. -
Isn't what the InlineCompletion mode would do ?
-
@SGaist
in inline completion only one suggestion is shown (in a highlighted text) but i want to show all of the possible suggestions -
Something like the windows cmd prompt that cycles through the possibilities or rather like a *nix shell that shows a list of possibilities ?
-
@SGaist
something like nix shell. -
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.
-
@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 suggestionsthis 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?
-
You can try to setup a single line QTextEdit like suggested here.