【发布时间】:2011-05-08 19:14:05
【问题描述】:
我似乎无法将参数传递给插槽。如果我不传递参数,该函数将正常运行。如果我传递一个参数(整数),我会在编译时收到错误“No such name type”和“No such slot”。
在我的标题中,我声明:
private slots:
void addButton(int);
signals:
void clicked(int)
在我的 Main.cpp 中,我这样做:
int count;
int count = 0;
QPushButton* button = new QPushButton("Button");
_layout->addWidget(button);
connect(button, SIGNAL(clicked(count), this, SLOT(addButton(count)));
....
void Main::addButton(int count) {
//do stuff with count
}
【问题讨论】:
标签: c++ qt qt4 signals-slots