我有一个QTableView,需要从它获取selectionChanged事件。我似乎无法让连接正常工作。我有:
MyWidget.h
..。
protected slots:
void slotLoadTransaction(const QItemSelection & selected, const QItemSelection & deselected);
private:
QTableView table;..。
MyWidget.cpp
..。
connect(
table->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection & selected, const QItemSelection & deselected)),
this,
SLOT(slotLoadTransaction(const QItemSelection & selected, const QItemSelection & deselected))
);..。
在运行时,我会得到“没有这样的信号”错误。
发布于 2010-03-04 01:14:33
您需要从信号和槽宏中删除变量名称:
connect(
table->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection &, const QItemSelection &)),
SLOT(slotLoadTransaction(const QItemSelection &, const QItemSelection &))
);Connect本质上是在查看函数签名,而变量名称使它感到困惑。
https://stackoverflow.com/questions/2376052
复制相似问题