Reputation: 147
I am having problems conecting the itemDoubleClicked() signal with a slot in my qt program. I think that it should be working but something goes wrong. I define the GUI by Qt code. Here is the connection part of the code.
MainWindow::MainWindow(QWidget* parent)
: QWidget(parent)
{
QListWidget *mImagesListWidget = new QListWidget();
connect(mImagesListWidget,SIGNAL(itemDoubleClicked(QListWidgetItem*)),this,SLOT(on_imageListItem_DoubleClicked(QListWidgetItem*)));
}
void MainWindow::on_imageListItem_DoubleClicked(QListWidgetItem listItem){
QMessageBox msgBox;
msgBox.setText(listItem.text());
msgBox.exec();
}
I don't know what could be the problem. Any help or sugestion is welcome. Thanks
Upvotes: 0
Views: 941
Reputation: 3989
Check your parameters.
Emitting:
itemDoubleClicked(QListWidgetItem*) <-- pointer
Slot:
on_imageListItem_DoubleClicked(QListWidgetItem listItem) <-- value
connect returns a bool. Always good to check it to see if a connection was made.
Upvotes: 3