I have a QTableWidget in my Qt application. I have QTableWidgetItem set in the cells of the table widget. I need to display a tool tip when the user hovers over the cells of the table. I have overridden the mouseMoveEvent() in my class and I am calling the method of tool tip to display it. But it does not work. I have also set the mouse tracking for the widget to true. The following is my code:
void TableDialog::mouseMoveEvent(QMouseEvent *event)
{
QPoint pos = event->pos();
QTableWidgetItem *item = ui.tableWidget->itemAt(pos);
if(!item)
return;
QToolTip::showText(ui.tableWidget->viewport()->mapToGlobal(pos), "Sample tool tip using mouseMoveEvent in TableDialog class");
}
Am I missing something here? Please let me know how to display this tool tip.