Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
QComplter with ToolTip
Sikarjan last edited by
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.