我在一个类的构造函数中将
QListView的signal连到我的slot,无论什么信号,也无论什么槽,死活都连不上???而
其他的比如QTableView的signal都工作正常,就是这个QListView的signal怎么都连不上????类似连接QListView的signal与slot的语句过程在其他类我都用了好多遍了,可以排除是语法的问题。大家有遇到过这种情形吗?
另外:有没有方法调试connect,跟踪signal发射后,都怎么调用slot,调用了哪些slot?
源代码:
在class a 中连接成功,工作正常
类a中声明:
class a: public QWidget
public slots:
void onDoubleClickPltList(const QModelIndex &mi);
类a构造函数中:
pelletList = new QListView(this);
pelletList->setModel(udata.pltModel);
this->connect(this->pelletList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(onDoubleClickPltList(const QModelIndex &)));
下面的class b中,QListView的任何信号连接到我的slot,死活都成功不了。害怕敲错了,我都是从a中copy过来,改改变量名的。在构造函数中有其他信号和槽的连接,都成功的。请各位看看。
类b中声明:
class b: public QWidget
public slots:
void onDoubleClickRxList(const QModelIndex &mi);
类b构造函数中:
rxList = new QListView(this);
rxList->setModel(udata.rxModel);
rxList->setEditTriggers(QAbstractItemView::NoEditTriggers);
this->connect(this->rxList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(onDoubleClickedRxList(const QModelIndex &)));
//this->connect(this->pelletList, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(onDoubleClickPltList(const QModelIndex &)));
[ 此贴被vlolv在2008-10-04 11:21重新编辑 ]