Qt tableview 顯示 懸浮提示 tooltip

這個蠻簡單的.

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

 

QQ: 1049870353

微信:yangsenhehe

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章