這個蠻簡單的.
1>
ui->tableView->setMouseTracking(true); // 設置鼠標追蹤
2>
connect(ui->tableView,SIGNAL(entered(QModelIndex)),this,SLOT(slot_tooltip(QModelIndex)));
3>
void Widget::slot_tooltip(QModelIndex index)
{
if(index.column()==0)
{
QToolTip::showText(QCursor::pos(),model->item(index.row(),index.column())->text());
}
}
後面有時間, 會把示例代碼 上傳github