hello i'm learning qt and i'm doing the folowing to add some widgets to a graphics scene
void MainWindow::addWidgets(QList<QWidget *> &list, int code)
{
if(code == CODE_INFO)
{
QWidget *layoutWidget = new QWidget();
QVBoxLayout *layout = new QVBoxLayout();
foreach(QWidget *w, list)
{
layout->addWidget(w);
this->connect(((ProductInfo*)w), SIGNAL(productClicked()), this, SLOT(getProductDetails()));
}
layoutWidget->setLayout(layout);
this->scene->addWidget(layoutWidget);
}
}
my ProductInfo class processes mouse release and emits a signal
void ProductInfo::mouseReleaseEvent(QMouseEvent *e)
{
QWidget::mouseReleaseEvent(e);
emit productClicked();
}
the problem is after adding the widgets to the scene they no longer get the mouse release event and don't emit productClicked signal but if i add them to the main window(not to the scene) they work as expected. What am i doing wrong?