C++ 鼠标事件不是';传递给QGraphicsSiteMgroup中添加的QPushButton

C++ 鼠标事件不是';传递给QGraphicsSiteMgroup中添加的QPushButton,c++,qt,C++,Qt,我在Windows7Ultimate x64上使用Qt4.8.3(32位) 在qgraphicscene子类的构造函数中,我有: QGraphicsItemGroup *point_table = new QGraphicsItemGroup; addItem(point_table); 在构造函数的后面部分: QPushButton *button = new QPushButton("Call++"); QGraphicsProxyWidget *inc_button = addWidge

我在Windows7Ultimate x64上使用Qt4.8.3(32位)

qgraphicscene
子类的构造函数中,我有:

QGraphicsItemGroup *point_table = new QGraphicsItemGroup;
addItem(point_table);
在构造函数的后面部分:

QPushButton *button = new QPushButton("Call++");
QGraphicsProxyWidget *inc_button = addWidget(button);
connect(button, SIGNAL(clicked()), this, SLOT(onCallIncrease()));
每当单击按钮时都会调用
onCallIncrease()
。但是,如果我将
inc_按钮添加到
point_表
,则不会调用
onCallIncrease()

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
即使我手动设置为接受鼠标左键:

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()
。为什么会发生这种情况?

我在[这里][1]找到了一个解决方案,它很有效。[1]: