Qt World Summit: Submit your Presentation

Custom completer does not show if there is no space before word

  • Hi,

    I combined the custom completer example with the text editor example but the completer does not show up when there is no space before the "text under curser". If the completer contains "form" it will not show up when I type


    but it will when I have a a space before:


    In both cases the text under curser function returns "for". When I put a qDebug() << "test" at the end of the keyPressed function, right behind pop it up it will show. So the entire function is executed but no popup window with the suggestions. I do not know how I should debug this. I just copy and pasted the sample code again into my code to make sure the keyPressed function is identical.

    Thanks for any suggestions

    I added the following code below the comment pop it up

        qDebug() << c->popup()->isVisible() << cr.x() << cr.y();

    The output is "true 89 92"
    But the actual popup window is a white square in the left upper corner of my screen (outside of the app window). Does this give a hint of what is going on?

  • Found the bug. The text under curser function returned the line break as well. When I printed out the value in the function it did not show but it did when I printed out the prefix value (the returned value) in the keyPressed function. After adding a trimmed() to the return value the code works again as expected.

Log in to reply