2013-07-10 13 views
0

我想插入漂亮,HTML文本到QTableWidget單元格使用setCellWidget和QTextEdit對象。這很好,但現在我的表沒有得到鼠標點擊(用於選擇等)或按鍵(用於選擇,導航等)。使用setCellWidget插入一個QTextEdit到QTableWidget丟失鍵盤和鼠標事件

下面是我如何設置單元格:

ui.myTableWidget->insertRow(rowCount); 

QTableWidgetItem *srcItem = new QTableWidgetItem(); 
ui.myTableWidget->setItem(rowCount, 0, srcItem); 

QTextEdit *text = new QTextEdit(); 
text->insertHtml(_GetHTML()); 
text->setFrameStyle(QFrame::NoFrame); 
text->setReadOnly(true); 
ui.myTableWidget->setCellWidget(rowCount, 0, text); 

感謝您的建議。

回答

相關問題