私はc++/ubuntuで作業しています。QTable を作成しました:
1 | 2
-------
aaaa|bbbb
cccc|dddd
....|....
行 2 全体を選択する方法を教えてください: cccc |dddd.
やった:
QModelIndexList indexes = ui->tableView->selectionModel()->selection().indexes();
for (int i = 0; i < indexes.count(); ++i)
{
QModelIndex index = indexes.at(i);
if (index.isValid())
{
QString s=index.data(Qt::DisplayRole).toString();
QMessageBox noc;
noc.setText(s);
noc.exec();
}
}
しかし、cccc要素が選択されているだけです。
感謝。Thxは非常に複雑です!