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. QTextCurser WordUnderCursor does not return word
QtWS25 Last Chance

QTextCurser WordUnderCursor does not return word

Scheduled Pinned Locked Moved Unsolved General and Desktop
qtextcursor
1 Posts 1 Posters 505 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.
  • SikarjanS Offline
    SikarjanS Offline
    Sikarjan
    wrote on last edited by
    #1

    Hi,

    I am working from the examples/tools/customcompleter. I removed the eow check to allow for a completion when I am within brackets or quotes. Unfortunately the function textUnderCursor() does not return the word when I am in a bracket or quote.

    class="erro|"
    

    returns

    "\""
    

    in stead of

    erro
    

    If there is a space before the second quote the returned value is as expected erro. So how can I change the textUnderCurser function to get the word when the curser is between a letter and a quote?

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

    I already tried around with moving the curser but this did not help.

    By the way, I do have the same issue in Creator with custom functions that require a variable.

    void myFunction(QString currentText);
    

    If I call this function and want to hand over a variable name, the completer is not popping up.

    QString lastText = "Some Text";
    myFunction(lastT|) // No completer showing up
    
    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