我有一个 QTableView
,需要获取其 selectionChanged 事件。但是我好像无法让连接工作。我尝试了以下代码:
MyWidget.h
...
protected slots:
void slotLoadTransaction(const QItemSelection & selected, const QItemSelection & deselected);
private:
QTableView table;
MyWidget.cpp
这是一个文件名为MyWidget.cpp的文件。
connect(
table->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection & selected, const QItemSelection & deselected)),
this,
SLOT(slotLoadTransaction(const QItemSelection & selected, const QItemSelection & deselected))
);
运行时出现“无此信号”错误。