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. QComplter with ToolTip
Qt 6.11 is out! See what's new in the release blog

QComplter with ToolTip

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

    Hi,

    I would like to add a tool tip to my completer suggestions. Much like Creator does. First I tried to add a tool tip to my underling completer model:

        QCompleter *completer = new QCompleter(this);
        QStandardItemModel *model = new QStandardItemModel(this);
        model->setItem(0, new QStandardItem("test"));
        model->item(0)->setToolTip("Tool Tip test");
        completer->setModel(model);
        completer->setCaseSensitivity(Qt::CaseInsensitive);
        ui->lineEdit->setCompleter(completer);
    

    But the tool tips do not show up.

    I managed to get tool tips with a custom delegate using QToolTip::showText(), see here, but that requires a point in screen coordinates, which I do not have.

    Is it either possible to make the above code work or pass the correct position to the delegate?

    Regarding the second approach. I already tried mapToGlobal but I do not have a widget I could call that on...
    Any help would be much appreciated.

    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