PDA

View Full Version : No such signal QListWidget::itemClicked



ouekah
22nd February 2010, 14:11
Hi,

I have a QListWidget that would like to connect it to a slot. This slot should be triggered every time an item of the list is clicked. Here is my (simple) code:

pages.h
-------------------------------------------------
class IndustryPage : public QWidget {
Q_OBJECT
public:
IndustryPage(QWidget *parent = 0);
private slots:
void test(QListWidgetItem *item);
};
-------------------------------------------------


pages.cpp
-------------------------------------------------
QGroupBox *sectorGroup = new QGroupBox(tr("Sector"));

QListWidget *sectorList = new QListWidget;
sectorList->setMaximumSize(QLISTWIDGET_SIZE);
connect(sectorList, SIGNAL(itemClicked(QListWidgetItem *item)), this, SLOT(test(QListWidgetItem *item)));


qmake and make run without any issue, but when I run the application there is an error message which says:

Object::connect: No such signal QListWidget::itemClicked(QListWidgetItem *item) in ../src/pages.cpp:67

which is weird since itemClicked is part of QListWidget... Does anybody have an idea ?

I'm using Qt 4.6 on a mac with OS X 10.6 and usually I have no problems with slots and signals...

high_flyer
22nd February 2010, 14:48
don't use parameters names in the connect() function, only types:

connect(sectorList, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(test(QListWidgetItem *)));