Моя кнопкаGroup уже загружается с 45 кнопками, я хочу что-то сделать после нажатия кнопки, это мой код:
#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";
}
Группа кнопок содержит сигнал с параметром QAbstractButton * или int, поэтому вы должны подключить этот сигнал к слоту с соответствующим параметром.
ui->buttonGroup->connect(ui->buttonGroup, SIGNAL(buttonClicked(QAbstractButton*)),
this, SLOT(your_slot(QAbstractButton* ));
Или вы можете подключить каждую кнопку с некоторым слотом.
Вы можете прочитать больше здесь: http://harmattan-dev.nokia.com/docs/library/html/qt4/signalsandslots.html
и здесь http://harmattan-dev.nokia.com/docs/library/html/qt4/qbuttongroup.html
buttonClicked ( QAbstractButton * button )
в QButtonGroup