方法2:
connect(button1, SIGNAL(yourClicked(int)), this, SLOT(YourButtonClick(int)));
connect(button2, SIGNAL(yourClicked(int)), this, SLOT(YourButtonClick(int)));
connect(button1, SIGNAL(click()), this, SLOT(dochangeValue1()));
connect(button2, SIGNAL(click()), this, SLOT(dochangeValue2()));
void YourWidget::dochangeValue1()
{
emit yourClicked(1);
}
void YourWidget::dochangeValue1()
{
emit yourClicked(2);
}
void YourWidget::YourButtonClick(int value)
{
//value==1 button1
//value==2 button2
}
方法二够恶心的吧?但是能做到你要做到事情。。。。