I have created a overwrite dialog box as shown below in QT/C++
here is the code associated:
DialogOverwrite::DialogOverwrite(QWidget *parent) :
QDialog(parent),
ui(new Ui::DialogOverwrite)
{
ui->setupUi(this);
QPushButton *YesToAllButton = ui->buttonBox->button(QDialogButtonBox::YesToAll);
QPushButton *YesButton = ui->buttonBox->button(QDialogButtonBox::Yes);
QPushButton *NoToAllButton = ui->buttonBox->button(QDialogButtonBox::NoToAll);
QPushButton *NoButton = ui->buttonBox->button(QDialogButtonBox::No);
QPushButton *CancelButton = ui->buttonBox->button(QDialogButtonBox::Cancel);
connect(ui->buttonBox, SIGNAL(clicked(QAbstractButton*)),this,
SLOT(dialogButton(QAbstractButton*)));
}
DialogOverwrite::~DialogOverwrite()
{
delete ui;
}
void DialogOverwrite::dialogButton(QAbstractButton* aButton) {
QDialogButtonBox::StandardButton button = ui->buttonBox->standardButton(aButton);
switch (button) {
case QDialogButtonBox::YesToAll:
OverwriteAction = YES_TO_ALL;
break;
....
I have declared QPushButton *YesToAllButton ... in order to connect to the buttonbox design in the ui and triggered the signal clicked.
The triggered works fine but when trying to catch on which button I have clicked, I receive a "NoButton" instead of YesToAll or any other.
Did I miss something
Thanks