I'm using Qt 4.8.3 (32 bit) on Windows 7 Ultimate x64.
In a constructor of a QGraphicsScene subclass, I have:
QGraphicsItemGroup *point_table = new QGraphicsItemGroup;
addItem(point_table);
Later in the constructor:
QPushButton *button = new QPushButton("Call++");
QGraphicsProxyWidget *inc_button = addWidget(button);
connect(button, SIGNAL(clicked()), this, SLOT(onCallIncrease()));
onCallIncrease() gets called whenever the button is clicked. However, if I add inc_button to point_table, onCallIncrease() doesn't get called.
QPushButton *button = new QPushButton("Call++");
QGraphicsProxyWidget *inc_button = addWidget(button);
point_table->addToGroup(inc_button);
connect(button, SIGNAL(clicked()), this, SLOT(onCallIncrease())); // doesn't work
Even if I manually set to accept left mouse button:
QPushButton *button = new QPushButton("Call++");
QGraphicsProxyWidget *inc_button = addWidget(button);
inc_button->setAcceptedMouseButtons(Qt::LeftButton);
point_table->setAcceptedMouseButtons(Qt::LeftButton);
point_table->addToGroup(inc_button);
connect(button, SIGNAL(clicked()), this, SLOT(onCallIncrease())); // doesn't work
onCallIncrease() doesn't get called on left mouse click. Why is this happening?