我想写一个小程序 (由于初学Qt,用了一个星期还未搞定,希望多多指教)
表格(QTabaleView) 用于总揽所有records
文本(QTextEdit) 用于详细显示一个record
需要实现下列几步:
(1) [关键步骤]选择一行
(2) [关键步骤] 被选中后发送一个信号
当表格(QTabaleView)中的一行(row) 被选中时,发送一个信号
(3)[这步我可以自己完成] 捕捉信号,显示详细信息。
void MainWindow::updateDetailedView(int row)
{
wordEditor->setPlainText(model->data(model->index(row, 0, QModelIndex()), Qt::DisplayRole).toString());
meningEditor->setPlainText(model->data(model->index(row, 1, QModelIndex()), Qt::DisplayRole).toString());
ratingEditor->setPlainText(model->data(model->index(row, 2, QModelIndex()), Qt::DisplayRole).toString());
}
[ 此帖被liwenfu24在2010-02-26 02:51重新编辑 ]