My buttonGroup is already load with 45 buttons i want do anything after a button is clicked this is my code:
#include "escogerpuesto.h"
#include "ui_escogerpuesto.h"
#include <iostream>
EscogerPuesto::EscogerPuesto(QWidget *parent) :
QWidget(parent),
ui(new Ui::EscogerPuesto)
{
ui->setupUi(this);
ui->buttonGroup->connect(ui->buttonGroup, SIGNAL(clicked()), this, SLOT(asientoClickeado));
}
EscogerPuesto::~EscogerPuesto()
{
delete ui;
}
void EscogerPuesto::asientoClickeado()
{
std::cout<<"click en asiento";
}
Button group contains signal with parameter QAbstractButton* or int, so you should connect this signal with slot which has an appropriate parameter.
ui->buttonGroup->connect(ui->buttonGroup, SIGNAL(buttonClicked(QAbstractButton*)),
this, SLOT(your_slot(QAbstractButton* ));
Or you can connect each button with some slot.
You can read more here: http://harmattan-dev.nokia.com/docs/library/html/qt4/signalsandslots.html
and here http://harmattan-dev.nokia.com/docs/library/html/qt4/qbuttongroup.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.