rishid
18th January 2008, 19:27
Hello,
I am trying to create a signal on a QListWidget on item click. For some reason the signal does not seem to be working. Code is below. I think it may have to do with my setItemWidget call, not sure if this blocks signals for the QListWidgetItem.
Edit: I just checked and connect is returning false, not sure what this problem is. And this is with the "ui.listWidget->setItemWidget(item, ne);" line commented out. So that is not causing the problem.
Thanks for the help.
for (int i = 0; i < 20; i++) {
QListWidgetItem * item = new QListWidgetItem("123456789", ui.listWidget);
item->setSizeHint(QSize(200,75));
NameEntry * ne = new NameEntry("John", "NU", QPixmap(":/fb/images/1604859.jpg"), "123456789" );
//connect(ui.listWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(changeDate()));
ui.listWidget->setItemWidget(item, ne);
connect(ui.listWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(changeDate()));
}
//... snip
void changeDate()
{
ui.lblDate->setText("Working...");
}
I am trying to create a signal on a QListWidget on item click. For some reason the signal does not seem to be working. Code is below. I think it may have to do with my setItemWidget call, not sure if this blocks signals for the QListWidgetItem.
Edit: I just checked and connect is returning false, not sure what this problem is. And this is with the "ui.listWidget->setItemWidget(item, ne);" line commented out. So that is not causing the problem.
Thanks for the help.
for (int i = 0; i < 20; i++) {
QListWidgetItem * item = new QListWidgetItem("123456789", ui.listWidget);
item->setSizeHint(QSize(200,75));
NameEntry * ne = new NameEntry("John", "NU", QPixmap(":/fb/images/1604859.jpg"), "123456789" );
//connect(ui.listWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(changeDate()));
ui.listWidget->setItemWidget(item, ne);
connect(ui.listWidget, SIGNAL(itemClicked(QListWidgetItem *)), this, SLOT(changeDate()));
}
//... snip
void changeDate()
{
ui.lblDate->setText("Working...");
}