【发布时间】:2021-05-30 05:02:06
【问题描述】:
我在我的 GUI 中插入了一个 QTableView 并设置了 selectionMode = SingleSelection , selectionBehavior = SelectRows。
我想通过更改所选行将我的插槽连接到一个信号(选择更改或另一个信号)。
请看我的代码:
connect(ui->tableView->selectionModel(),
SIGNAL( selectionChanged(const QItemSelection&,
const QItemSelection&)), this ,SLOT(myslot()));
我收到一条错误消息:
QObject::connect: 无法连接 (null)::selectionChanged(const QItemSelection&, const QItemSelection&) 到 Info::myslot
【问题讨论】:
-
请编辑您的问题以澄清
"My Code doesn't work"的含义。顺便说一句,如果可能的话,您可能应该转到Qt5signal/slot syntax。